memory: exit early from memory_exchange() upon write-back error
authorJan Beulich <jbeulich@suse.com>
Wed, 5 Apr 2017 14:39:16 +0000 (16:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 5 Apr 2017 14:39:16 +0000 (16:39 +0200)
commit1cf4d2ec0d7c0cb53729ca810e416793030f6f07
treec1c7d73d4340eb3ea6363cc16270729aaf08b6a0
parent2cb1f77c0494538ede7e44896db70d9cdddbcd66
memory: exit early from memory_exchange() upon write-back error

There's no point in continuing if in the end we'll return -EFAULT
anyway. It also seems wrong to report a chunk for which at least one
write-back failed as successfully exchanged (albeit the indication of
an error is also not fully correct, as the exchange happened in that
case at least partially - retrieving the GFN to assign the memory to
and/or handing back the information on the replacement memory didn't
work). In any case limiting the amount of damage done to the guest
can't be all that bad an idea.

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Released-acked-by: Julien Grall <julien.grall@arm.com>
xen/common/memory.c